package com.lc202309;

/**
 * Description:
 *
 * @Create 2023/9/10 21:54
 * @Version 1.0
 */
public class Solution704 {
    public int search(int[] nums, int target) {
        int start = 0;
        int end = nums.length - 1;
        int index;
        while (start <= end) {
            index = (start + end) / 2;
            if (nums[index] == target) {
                return index;
            }
            if (nums[index] > target) {
                end = index - 1;
                continue;
            }
            start = index + 1;
        }
        return -1;
    }
}
